
import SwiftUI

fileprivate struct BackgroundClearView: UIViewRepresentable {
    func updateUIView(_ uiView: UIViewType, context: Context) {
    }
    
    func makeUIView(context: Context) -> some UIView {
        let view = UIView()
        DispatchQueue.main.async {
            view.superview?.superview?.backgroundColor = .clear
        }
        return view
    }
}

struct ModalPage<Content:View > : View {
  
    var onClose:(()->Void)?
    @ViewBuilder var content:()-> Content // 内容
    var height:CGFloat = 300 // 高度
    var body: some View {
        ZStack{
            VStack(spacing:0){
                Spacer()
                content()
                    .padding(.bottom,30)
                .background(RoundedCorners(color: .g_color_bg_white,tl: 10,tr: 10))
            }.edgesIgnoringSafeArea(.all)
        }
    }
}

#if DEBUG
struct ModalPage_Previews : PreviewProvider {
    static var previews: some View {
        ModalPage(onClose: {}){
           
        }
    }
}
#endif
